package com.plum.admin.modules.common;

import com.plum.admin.common.annotation.RaterLimit;
import com.plum.admin.common.util.R;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 *
 * @author 子丶沫
 * @version 1.0
 * @date 2021/8/13 15:35
 */
@RestController
@RequestMapping("/common")
@Slf4j
public class CommonController {
    @Autowired
    private RedissonClient redisson;

    @GetMapping("/noLogin")
    public R<Object> noLogin(){
        return R.error("您还未登录");
    }

    @GetMapping("/test")
    @RaterLimit(rate = 1,rateInterval = 5000)
    public R<Object> test(){

        return R.ok();
    }
    @RequestMapping(value = "/lockAndLimit", method = RequestMethod.GET)
    @ApiOperation(value = "同步锁限流测试")
    @ResponseBody
    public R<Object> test1() {



        return R.ok(null);
    }
}
